﻿using System;
using Velocity4Net.Runtime.Parser;

namespace Velocity4Net.Errors
{

    /*
     * Licensed to the Apache Software Foundation (ASF) under one
     * or more contributor license agreements.  See the NOTICE file
     * distributed with this work for additional information
     * regarding copyright ownership.  The ASF licenses this file
     * to you under the Apache License, Version 2.0 (the
     * "License"); you may not use this file except in compliance
     * with the License.  You may obtain a copy of the License at
     *
     *   http://www.apache.org/licenses/LICENSE-2.0
     *
     * Unless required by applicable law or agreed to in writing,
     * software distributed under the License is distributed on an
     * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
     * KIND, either express or implied.  See the License for the
     * specific language governing permissions and limitations
     * under the License.
     */



    /**
     * Exception generated to indicate parse errors caught during
     * directive initialization (e.g. wrong number of arguments)
     *
     * @author <a href="mailto:wglass@forio.com">Will Glass-Husain</a>
     * @version $Id: TemplateInitException.java 1866609 2019-09-08 10:42:47Z cbrisson $
     * @since 1.5
     */
    public class TemplateInitException : VelocityException
       , ExtendedParseException
    {
        private readonly String templateName;
        private readonly int col;
        private readonly int line;

        /**
         * Version Id for serializable
         */
        private const long serialVersionUID = -4985224672336070621L;

        /**
         * @param msg
         * @param templateName
         * @param col
         * @param line
         */
        public TemplateInitException(String msg,
                 String templateName, int col, int line) : base(msg)
        {
            this.templateName = templateName;
            this.col = col;
            this.line = line;
        }

        /**
         *
         * @param msg
         * @param parseException
         * @param templateName
         * @param col
         * @param line
         */
        public TemplateInitException(String msg, ParseException parseException,
                 String templateName, int col, int line) : base(msg, parseException)
        {
            this.templateName = templateName;
            this.col = col;
            this.line = line;
        }

        /**
         *
         * @param msg
         * @param parseException
         * @param stacktrace
         * @param templateName
         * @param col
         * @param line
         * @since 2.2
         */
        public TemplateInitException(String msg, ParseException parseException, String[] stacktrace,
                                     String templateName, int col, int line) : base(msg, parseException, stacktrace)
        {
            this.templateName = templateName;
            this.col = col;
            this.line = line;
        }

        /**
         * Returns the Template name where this exception occurred.
         * @return the template name
         */
        public String getTemplateName()
        {
            return templateName;
        }

        /**
         * Returns the line number where this exception occurred.
         * @return the line number
         */
        public int getLineNumber()
        {
            return line;
        }

        /**
         * Returns the column number where this exception occurred.
         * @return the line number
         */
        public int getColumnNumber()
        {
            return col;
        }




    }
}